/**
 *  src[string] pdf的url
 *  show[bool] 打开pdf
 *  onCancel[fn] 关闭查看器的回调
 *  */

import React from 'react';
import { Modal } from 'antd';

export default (props) => {
  const {
    src,
    show = true,
    title = '课程查看',
    onCancel = () => {}
  } = props;
  if (!src) {
    return null;
  }
  return (
    <Modal
      style={{ top: 10 }}
      footer={false}
      title={title}
      visible={show}
      width={1000}
      onCancel={onCancel}
    >
      <div style={{ height: '82vh' }}>
        <iframe
          src={src}
          frameBorder="0"
          height="100%"
          width="100%"
        />
      </div>
    </Modal>
  );
}
